package org.tp8.sampleapp.scheduler.task;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.tp8.sampleapp.exc.SampleAppException;
import org.tp8.sampleapp.service.facade.CourseFacade;
import org.tp8.sampleapp.service.facade.StudentFacade;
import org.tp8.sampleapp.service.facade.TeacherFacade;
import org.tp8.sampleapp.util.SampleAppLogger;

/**
 * The Class SampleTask.
 */
@Component("sampleTask")
public class SampleTask {

	/** The Constant log. */
	private final static SampleAppLogger log = new SampleAppLogger(
			SampleTask.class);

	@Autowired
	private CourseFacade courseFacade;

	@Autowired
	private StudentFacade studentFacade;

	@Autowired
	private TeacherFacade teacherFacade;

	/**
	 * Prints the current time.
	 * 
	 * @throws SampleAppException
	 */
	public void printCurrentTime() throws SampleAppException {
		// printing current system time
		log.info("Scheduled job :::  Teachers : " + teacherFacade.count()
				+ " Students: " + studentFacade.count() + " Courses: "
				+ courseFacade.count());
	}

}